package pack0629;

public class AnimalDemo {
    public static void main(String[] args) {
        Animal a = new Cat();
        a.age = 3;
        a.name = "猫耳朵";
        System.out.println(a.getName()+","+a.getAge());
        a.eat();
        System.out.println("--------------");

        a = new Cat("野猫",4);
        System.out.println(a.getName()+","+a.getAge());
        a.age = 6;
        a.name = "钊咪";
        a.eat();
        System.out.println(a.getName()+","+a.getAge());
        System.out.println("---------------");

        Animal b = new Dog();
        b.name = "土狗";
        b.age = 5;
        System.out.println(b.getName()+","+b.getAge());
        b.eat();
        System.out.println("---------------");

        b = new Dog("钊汪",8);
        System.out.println(b.getName()+","+b.getAge());
        b.eat();

    }
}
